package m202405.d12;

import java.util.*;

/**
 * @@author: 爱做梦的锤子
 * @date: 2024/5/12 13:13
 */
public class Q73 {
    public void setZeroes(int[][] matrix) {
        Set<Integer> line = new HashSet<>();
        Set<Integer> col = new HashSet<>();
        for (int i = 0; i < matrix.length; i++) {
            for (int j = 0; j < matrix[i].length; j++) {
                if (matrix[i][j] == 0) {
                    line.add(i);
                    col.add(j);
                }
            }
        }

        for (Integer integer : line) {
            Arrays.fill(matrix[integer], 0);
        }
        for (int i = 0; i < matrix.length; i++) {
            for (Integer integer : col) {
                matrix[i][integer] = 0;
            }
        }
    }
}
